﻿<gui:AbstractInlineRefactorDialog x:Class="SharpRefactoring.Gui.CreatePropertiesDialog"
	Header="{sd:Localize AddIns.SharpRefactoring.CreateProperties.Title}"
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:gui="clr-namespace:SharpRefactoring.Gui"
	xmlns:sd="http://icsharpcode.net/sharpdevelop/core"
	xmlns:widgets="http://icsharpcode.net/sharpdevelop/widgets"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
	<Grid Cursor="Arrow" KeyboardNavigation.TabNavigation="Cycle">
		<Grid.Resources>
			<Style x:Key="ListViewItemFocusHighlight" TargetType="{x:Type ListViewItem}">
			<!-- This style replaces the default ListViewItem template with one that highlights the focused item instead of the selected items -->
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type ListViewItem}">
						<Border Name="Bd"
						        Background="{TemplateBinding Background}"
						        BorderBrush="{TemplateBinding BorderBrush}"
						        BorderThickness="{TemplateBinding BorderThickness}"
						        Padding="{TemplateBinding Padding}"
						        SnapsToDevicePixels="true">
							<GridViewRowPresenter Content="{TemplateBinding Content}" Columns="{TemplateBinding GridView.ColumnCollection}"/>
						</Border>
						<ControlTemplate.Triggers>
							<Trigger Property="IsKeyboardFocusWithin"
							         Value="true">
								<Setter TargetName="Bd"
								        Property="Background"
								        Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
								<Setter Property="Foreground"
								        Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}"/>
							</Trigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		</Grid.Resources>
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto" />
			<RowDefinition Height="Auto" />
			<RowDefinition Height="*" />
			<RowDefinition Height="Auto" />
		</Grid.RowDefinitions>
		<TextBlock Margin="3"
		           Text="{sd:Localize AddIns.SharpRefactoring.CreateProperties.Description}"
		           TextWrapping="Wrap" />
		<CheckBox x:Name="implementInterface" Margin="3" Grid.Row="1" Content="{sd:Localize AddIns.SharpRefactoring.CreateProperties.Description.ImplementINotifyPropertyChanged}" />
		<ListView x:Name="listBox" Grid.Row="2" SelectionMode="Multiple" KeyboardNavigation.TabNavigation="Cycle" ItemContainerStyle="{StaticResource ListViewItemFocusHighlight}" MaxHeight="300">
			<ListView.View>
				<GridView>
					<GridViewColumn Header="{sd:Localize AddIns.SharpRefactoring.InsertCtor.VariableLabel}">
						<GridViewColumn.CellTemplate>
							<DataTemplate>
								<CheckBox Content="{Binding Text}" IsChecked="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBoxItem}},Path=IsSelected}" />
							</DataTemplate>
						</GridViewColumn.CellTemplate>
					</GridViewColumn>
					<GridViewColumn Header="{sd:Localize AddIns.SharpRefactoring.CreateProperties.AddSetterLabel}">
						<GridViewColumn.CellTemplate>
							<DataTemplate>
								<CheckBox IsChecked="{Binding AddSetter, Mode=TwoWay}" IsEnabled="{Binding IsSetable}" />
							</DataTemplate>
						</GridViewColumn.CellTemplate>
					</GridViewColumn>
				</GridView>
			</ListView.View>
		</ListView>
		<widgets:UniformGridWithSpacing Columns="3" Margin="3" Grid.Row="3" HorizontalAlignment="Center">
			<Button Content="{sd:Localize Global.OKButtonText}" Click="OKButtonClick" Style="{x:Static sd:GlobalStyles.ButtonStyle}" />
			<Button Content="{sd:Localize Global.CancelButtonText}" Click="CancelButtonClick" Style="{x:Static sd:GlobalStyles.ButtonStyle}" />
			<ToggleButton x:Name="selectAll" Content="{sd:Localize Global.SelectAllButtonText}" IsChecked="{Binding AllSelected, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type gui:CreatePropertiesDialog}}, Mode=TwoWay}" Checked="SelectAllChecked" Unchecked="SelectAllUnchecked" />
		</widgets:UniformGridWithSpacing>
	</Grid>
</gui:AbstractInlineRefactorDialog>